package com.backend.securitiessystem.crawler.properties;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 爬虫配置读取类
 *
 * @author qksuki
 * @date 2024-05-20 02:23:42
 */
@Data
@Component
public final class CrawlerProperties {
    /**
     * htmlunit 配置
     */
    @Value("${cra.htmlConfig.jsLoadingTime}")
    private Integer jsLoadingTime;
    @Value("${cra.htmlConfig.setJavaScriptEnabled}")
    private Boolean setJavaScriptEnabled;
    @Value("${cra.htmlConfig.setCssEnabled}")
    private Boolean setCssEnabled;
    @Value("${cra.htmlConfig.setThrowExceptionOnScriptError}")
    private Boolean setThrowExceptionOnScriptError;
    @Value("${cra.htmlConfig.setThrowExceptionOnFailingStatusCode}")
    private Boolean setThrowExceptionOnFailingStatusCode;

    /**
     * 目标读取网站配置
     */
    @Value("${cra.target.asianChinaStockMarkets.url}")
    private String asianChinaStockMarketsUrl;

    @Value("#{'${cra.target.asianChinaStockMarkets.regex}'.split(',')}")
    private List<String> asianChinaStockMarkets;

    @Value("${cra.target.newShare.url}")
    private String newShareUrl;

    @Value("${cra.target.securitiesNews.url}")
    private String securitiesNewsUrl;

    @Value("${cra.target.capitalFlow.url}")
    private String capitalFlowUrl;

    @Value("${cra.target.riseFall.url}")
    private String riseFallUrl;
}

